<?php
namespace app\middleware;

class CheckIp
{
    // 状态 关闭：false，开启：true
    private $status = true;
    // ip库
    private $StoreIp = ['127.0.0.2','127.0.0.1'];

    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        // 禁止访问
        if($this->status==true){
            if(in_array($request->ip(),$this->StoreIp)){
                exit('禁止访问');
            }
        }
        return $next($request);
    }


}
